const js = require('@eslint/js');
const globals = require('globals');
const vue = require('eslint-plugin-vue');
const vueParser = require('vue-eslint-parser');

module.exports = [
    js.configs.recommended,
    {
        files: ['**/*.js'],
        languageOptions: {
            ecmaVersion: 'latest',
            sourceType: 'module',
            globals: {
                ...globals.browser,
                ...globals.node
            }
        },
        rules: {
            'eqeqeq': 'warn',
            'no-unused-vars': ['warn', {
                vars: 'local',
                args: 'none'
            }],
            'no-undef': 'warn',
            'no-useless-escape': 'warn',
            'no-empty': 'off',
        }
    },
    {
        files: ['**/*.vue'],
        languageOptions: {
            parser: vueParser,
            parserOptions: {
                ecmaVersion: 'latest',
                sourceType: 'module'
            },
            globals: {
                ...globals.browser,
                ...globals.node
            }
        },
        plugins: {
            vue
        },
        rules: {
            'eqeqeq': 'warn',
            'no-unused-vars': ['warn', {
                vars: 'local',
                args: 'none'
            }],
            'no-undef': 'warn',
            'no-useless-escape': 'warn',
            'no-empty': 'off',
            'vue/no-side-effects-in-computed-properties': 'warn',
            'vue/no-mutating-props': 'warn'
        }
    }
];